import java.util.ListIterator;
import java.util.Vector;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Alejo
 */
public class PriorityVector<E extends Comparable<E>>  implements PriorityQueue <E> {
protected Vector<E> data;
public PriorityVector()
// post: constructs a new priority queue
{
data = new Vector<E>();
}

public E getFirst()
// pre: !isEmpty()
// post: returns the minimum value in the priority queue
{
return data.get(0);
}
public E remove()
// pre: !isEmpty()
// post: removes and returns minimum value in priority queue
{
return data.remove(0);
}

    @Override
    public void add(E value) {
       if(data.isEmpty())
       {
           data.add(value);
       }
       else
       {
           int i = -1;
           do
           {
               i++;
           } while(data.elementAt(i).compareTo(value) <= 0);
           if(i == (data.size()-1)) // llego al ultimo
           {
               data.add(value);
           }
           else
           {
               data.insertElementAt(value, i);
           }
           
       }
    }

    @Override
    public boolean isEmpty() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int size() {
      
      int  cantidad = data.size();
      return cantidad;
    }

    @Override
    public void clear() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
